import org.jibble.pircbot.*;
public class bot extends PircBot
{
    private String botnick;
    private String botquser;
    private String botqpass;
    private String botchan;
    public  bot () throws java.io.IOException,IrcException { 
        this.botnick=ini.read("nick");
        this.botquser=ini.read("quser");
        this.botqpass=ini.read("qpass");
        this.botchan=ini.read("chan");
        setName(ini.read("nick")); 
        setVerbose(true);
        if (ini.read("ircpass") == null) {
            connect(ini.read("ircip"),Integer.parseInt(ini.read("ircport")));
        } else {
            connect(ini.read("ircip"),Integer.parseInt(ini.read("ircport")),ini.read("ircpass"));
        }
    }
    protected void onConnect()  {
        sendMessage("Q@CServe.quakenet.org","auth " + this.botquser + " " + this.botqpass);
        setMode(this.botnick,"+x");
        joinChannel(this.botchan);
    }
    public void onMessage(String channel, String sender,String login, String hostname,String message) {
        System.out.println(channel + " " + sender + " " + login + " " + hostname + " " + message);
        if (message.equalsIgnoreCase("time")) {
            String time = new java.util.Date().toString();
            sendMessage(channel, sender + ": " + time);
        }
    }
}